package com.itboye.mengwu.data.repository;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.mengwu.data.interfaces.ILiShiTiXianInfaser;
import com.itboye.mengwu.data.model.WithdrawalsBean;

public class LiShiTiXianRepository extends BaseNetRepository implements ILiShiTiXianInfaser<WithdrawalsBean>{

	public static final String LiShiTiXian = "BY_BbsUserCenter_walletLog";// 历史提现
	
	public static final String ShenQingTiXian = "BY_BbsUserCenter_walletOut";// 申请提现
	
	public static final String BangDing = "BY_User_bindWithdraw";// 绑定支付宝
	public  LiShiTiXianRepository(ICompleteListener listener){
		super(listener);
	}
	@Override
	public void add(WithdrawalsBean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(WithdrawalsBean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(WithdrawalsBean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void getInfo(WithdrawalsBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<WithdrawalsBean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", model.getUid());// uid

		// 目前最简化调用
		// START
		(new Builder<WithdrawalsBean>())
				.setTypeVerParamsAndReturnClass(LiShiTiXian, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<WithdrawalsBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<WithdrawalsBean> queryYouHuiQuan(WithdrawalsBean model) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public void getTiXian(String uid, String money) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<WithdrawalsBean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", uid);// uid
		params.put("money", money);

		// 目前最简化调用
		// START
		(new Builder<WithdrawalsBean>())
				.setTypeVerParamsAndReturnClass(ShenQingTiXian, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<WithdrawalsBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}
	
	@Override
	public void getBangDing(String uid, String mobile, String code,
			String account, String realname) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<String>() {
		}.getType();
		String apiVer = "101";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", uid);// uid
		
		params.put("mobile", mobile);// uid
		
		params.put("code", code);// uid
		
		params.put("account", account);// uid
		
		params.put("account_type", "1");
		
		params.put("realname", realname);// uid

		// 目前最简化调用
		// START
		(new Builder<String>())
				.setTypeVerParamsAndReturnClass(BangDing, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<String>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
